<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    // 检查用户是否已登录
    Object userObj = session.getAttribute("user");
    if (userObj != null) {
        // 如果已登录，根据角色跳转到对应的仪表板
        response.sendRedirect("books");
        return;
    }
%>
<html>
<head>
    <title>图书管理系统 - 首页</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }

        .header {
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            padding: 20px 0;
            text-align: center;
            color: white;
        }

        .header h1 {
            font-size: 2.5rem;
            margin-bottom: 10px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
        }

        .header p {
            font-size: 1.2rem;
            opacity: 0.9;
        }

        .container {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 40px 20px;
        }

        .welcome-card {
            background: white;
            border-radius: 15px;
            padding: 50px;
            text-align: center;
            box-shadow: 0 15px 35px rgba(0,0,0,0.1);
            max-width: 500px;
            width: 100%;
        }

        .welcome-icon {
            font-size: 4rem;
            margin-bottom: 20px;
            color: #667eea;
        }

        .welcome-card h2 {
            color: #333;
            margin-bottom: 20px;
            font-size: 2rem;
        }

        .welcome-card p {
            color: #666;
            margin-bottom: 30px;
            line-height: 1.6;
            font-size: 1.1rem;
        }

        .btn-group {
            display: flex;
            flex-direction: column;
            gap: 15px;
            margin-top: 30px;
        }

        .btn {
            display: inline-block;
            padding: 15px 30px;
            text-decoration: none;
            border-radius: 8px;
            font-size: 1.1rem;
            font-weight: 600;
            transition: all 0.3s ease;
            text-align: center;
        }

        .btn-primary {
            background: #667eea;
            color: white;
        }

        .btn-primary:hover {
            background: #5a6fd8;
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }

        .btn-secondary {
            background: transparent;
            color: #667eea;
            border: 2px solid #667eea;
        }

        .btn-secondary:hover {
            background: #667eea;
            color: white;
            transform: translateY(-2px);
        }

        .features {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
            gap: 20px;
            margin-top: 40px;
            padding-top: 40px;
            border-top: 1px solid #eee;
        }

        .feature {
            text-align: center;
            padding: 20px;
        }

        .feature-icon {
            font-size: 2.5rem;
            margin-bottom: 15px;
            color: #667eea;
        }

        .feature h3 {
            color: #333;
            margin-bottom: 10px;
        }

        .feature p {
            color: #666;
            font-size: 0.9rem;
        }

        .test-accounts {
            background: #f8f9fa;
            border-radius: 10px;
            padding: 20px;
            margin-top: 30px;
            text-align: left;
        }

        .test-accounts h4 {
            color: #333;
            margin-bottom: 15px;
            text-align: center;
        }

        .account-info {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        .account-item {
            padding: 8px;
            background: white;
            border-radius: 5px;
            font-size: 0.9rem;
        }

        .footer {
            background: rgba(0, 0, 0, 0.1);
            color: white;
            text-align: center;
            padding: 20px;
            margin-top: auto;
        }

        @media (max-width: 768px) {
            .welcome-card {
                margin: 20px;
                padding: 30px;
            }

            .account-info {
                grid-template-columns: 1fr;
            }
        }
    </style>
</head>
<body>
<div class="header">
    <h1>📚 图书管理系统</h1>
    <p>高效、便捷的图书查询与管理平台</p>
</div>

<div class="container">
    <div class="welcome-card">
        <div class="welcome-icon">📖</div>
        <h2>欢迎使用图书管理系统</h2>
        <p>这是一个功能完善的图书查询与管理系统，为您提供便捷的图书检索、借阅管理服务。</p>

        <div class="btn-group">
            <a href="login.jsp" class="btn btn-primary">立即登录</a>
            <a href="books" class="btn btn-secondary">浏览图书</a>
        </div>

        <div class="features">
            <div class="feature">
                <div class="feature-icon">🔍</div>
                <h3>快速检索</h3>
                <p>支持按书名、作者、ISBN等多条件搜索</p>
            </div>
            <div class="feature">
                <div class="feature-icon">📊</div>
                <h3>智能管理</h3>
                <p>完善的借阅管理和图书状态跟踪</p>
            </div>
            <div class="feature">
                <div class="feature-icon">👥</div>
                <h3>多角色支持</h3>
                <p>区分读者和管理员权限，各司其职</p>
            </div>
        </div>

        <div class="test-accounts">
            <h4>测试账号信息</h4>
            <div class="account-info">
                <div class="account-item">
                    <strong>管理员账号：</strong><br>
                    用户ID: 1001<br>
                    密码: admin123
                </div>
                <div class="account-item">
                    <strong>普通用户账号：</strong><br>
                    用户ID: 2001<br>
                    密码: 123456
                </div>
            </div>
        </div>
    </div>
</div>

<div class="footer">
    <p>图书管理系统 &copy; 2025 - 课程设计项目</p>
</div>
</body>
</html>